package com.example.tests;

import static org.testng.Assert.*;
import org.testng.annotations.Test;

import com.example.fw.AccountHelper;
import com.example.fw.JamesHelper;
import com.example.fw.User;

@Test
public class DeleteUser extends TestBase {
	
	JamesHelper james;
	AccountHelper accHelper;
	
	public User user = new User().setLogin("testuser1").setPassword("123456")
			.setEmail("testuser1@localhost.localdomain");
	
	public User admin = new User().setLogin("administrator").setPassword("root")
			.setEmail("root@localhost");
	
	public void deleteUser(){		
		app.getAccountHelper()
		    .loginAdministrator(admin)
		    .gotoUserManagePage();
		
		SortedListOf<User> oldList = app.getAccountHelper().getList();
		
		app.getAccountHelper().deleteUser(user);
		
		SortedListOf<User> newList = app.getAccountHelper().getList();
		// compare states	 
		assertEquals(oldList, newList.add(user));
	}
	
}
